#include <iostream>

using namespace std;
int n, m;
const int N = 3010, MOD = 2333;
int dp[N][N];
int a[N][N];
int main()
{
    scanf("%d%d", &n, &m);
    dp[n][0] = 1;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            scanf("%d", &a[i][j]);

    for (int i = n; i >= 1; i--)
        for (int j = 1; j <= m; j++)
            if (a[i][j] == 0)
            {
                dp[i][j] = (dp[i][j - 1] + dp[i + 1][j]) % MOD;
            }

    cout << dp[1][m] << endl;
    return 0;
}